/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.be;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ADMINISTRADOR
 */
@Entity
@Table(name = "col_vinculo_colegiado")
//@NamedQueries({@NamedQuery(name = "VinculoColegiado.findAll", query = "SELECT v FROM VinculoColegiado v"), @NamedQuery(name = "VinculoColegiado.findByVinCodigo", query = "SELECT v FROM VinculoColegiado v WHERE v.vinCodigo = :vinCodigo"), @NamedQuery(name = "VinculoColegiado.findByVinapellPaterno", query = "SELECT v FROM VinculoColegiado v WHERE v.vinapellPaterno = :vinapellPaterno"), @NamedQuery(name = "VinculoColegiado.findByVinapellMaterno", query = "SELECT v FROM VinculoColegiado v WHERE v.vinapellMaterno = :vinapellMaterno"), @NamedQuery(name = "VinculoColegiado.findByVinNombres", query = "SELECT v FROM VinculoColegiado v WHERE v.vinNombres = :vinNombres"), @NamedQuery(name = "VinculoColegiado.findByVinfechaNac", query = "SELECT v FROM VinculoColegiado v WHERE v.vinfechaNac = :vinfechaNac"), @NamedQuery(name = "VinculoColegiado.findByVinVive", query = "SELECT v FROM VinculoColegiado v WHERE v.vinVive = :vinVive")})
public class VinculoColegiado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "vin_codigo")
    private Long vinCodigo;
    @Basic(optional = false)
    @Column(name = "vin_apellPaterno")
    private String vinapellPaterno;
    @Basic(optional = false)
    @Column(name = "vin_apellMaterno")
    private String vinapellMaterno;
    @Basic(optional = false)
    @Column(name = "vin_nombres")
    private String vinNombres;
    @Column(name = "vin_fechaNac")
    @Temporal(TemporalType.DATE)
    private Date vinfechaNac;
    @Column(name = "vin_vive")
    private Boolean vinVive;
    @Basic(optional = false)
    @Column(name = "vin_tipoVinculo")
    private String vintipoVinculo;
    @Column(name = "vin_estado")
    private boolean vinEstado; ;

    
    @JoinColumn(name = "col_codigo", referencedColumnName = "col_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Colegiado colCodigo;

    public VinculoColegiado() {
    }

    public VinculoColegiado(Long vinCodigo) {
        this.vinCodigo = vinCodigo;
    }

    public VinculoColegiado(Long vinCodigo, String vinapellPaterno, String vinapellMaterno, String vinNombres) {
        this.vinCodigo = vinCodigo;
        this.vinapellPaterno = vinapellPaterno;
        this.vinapellMaterno = vinapellMaterno;
        this.vinNombres = vinNombres;
    }

    public Long getVinCodigo() {
        return vinCodigo;
    }

    public void setVinCodigo(Long vinCodigo) {
        this.vinCodigo = vinCodigo;
    }

    public String getVinapellPaterno() {
        return vinapellPaterno;
    }

    public void setVinapellPaterno(String vinapellPaterno) {
        this.vinapellPaterno = vinapellPaterno;
    }

    public String getVinapellMaterno() {
        return vinapellMaterno;
    }

    public void setVinapellMaterno(String vinapellMaterno) {
        this.vinapellMaterno = vinapellMaterno;
    }

    public String getVinNombres() {
        return vinNombres;
    }

    public void setVinNombres(String vinNombres) {
        this.vinNombres = vinNombres;
    }

    public Date getVinfechaNac() {

        return vinfechaNac;
    }

    public void setVinfechaNac(Date vinfechaNac) {
        this.vinfechaNac = vinfechaNac;
    }

    public String getFechaNacHIjo(){
        SimpleDateFormat sd = new SimpleDateFormat("dd/MM/yyyy");
        return sd.format(vinfechaNac);
    }

    public Boolean getVinVive() {
        return vinVive;
    }

    public void setVinVive(Boolean vinVive) {
        this.vinVive = vinVive;
    }

    public String getVintipoVinculo() {
        return vintipoVinculo;
    }

    public void setVintipoVinculo(String vintipoVinculo) {
        this.vintipoVinculo = vintipoVinculo;
    }

    public Colegiado getColCodigo() {
        return colCodigo;
    }

    public void setColCodigo(Colegiado colCodigo) {
        this.colCodigo = colCodigo;
    }

    public boolean getVinEstado() {
        return vinEstado;
    }

    public void setVinEstado(boolean vinEstado) {
        this.vinEstado = vinEstado;
    }

    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (vinCodigo != null ? vinCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VinculoColegiado)) {
            return false;
        }
        VinculoColegiado other = (VinculoColegiado) object;
        if ((this.vinCodigo == null && other.vinCodigo != null) || (this.vinCodigo != null && !this.vinCodigo.equals(other.vinCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.colegiatura.be.VinculoColegiado[vinCodigo=" + vinCodigo + "]";
    }

}
